<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

/**
 * @var Route $router
 */

$router->post('/login', 'LoginController@login');
$router->post('/register', 'UserRegisterController@register');


// 需授权登陆才有权限调用的接口
$router->group(['middleware' => 'api.auth'], function ($router) {
    /**
     * @var Route $router
     */
    $router->delete('/logout', 'LoginController@logout');

    $router->group(['prefix' => '/user'], function ($router) {
        /**
         * @var Route $router
         */
        $router->get('/profiles', 'UserProfileController@profile');
        $router->put('/avatar', 'UserProfileController@avatar');
        $router->put('/password', 'UserProfileController@password');
        $router->put('/update', 'UserProfileController@update');


    });
});


